package org.zjt.thread.interrupt;

import java.net.MalformedURLException;

/**
 * Description:
 *
 * @author juntao.zhang
 * Date: 2018-05-31 下午8:57
 * @see
 */
public class Main {

    public static void main(String[] args) throws MalformedURLException, InterruptedException {

        NIOsend();

    }


    public static void BIOsend() throws MalformedURLException {
        ThreadPoolManager threadPoolManager = new ThreadPoolManager();
        HttpRequest httpRequest = new HttpRequest(threadPoolManager);
        new Thread(httpRequest).start();

        for (int i = 0; i < 1000; i++) {
            httpRequest.send();
        }
    }

    public static void NIOsend() throws MalformedURLException {
        ThreadPoolManager threadPoolManager = new ThreadPoolManager();
        HttpRequest httpRequest = new HttpRequest(threadPoolManager);
        new Thread(httpRequest).start();

        for (int i = 0; i < 1000; i++) {
            httpRequest.asyncSend();
        }
    }
}
